package com.green.common.fusionchart;

import java.util.List;

import com.green.common.fusionchart.enums.DefaultColorEnum;

public class SingleColumn2D extends Column2D {

	private List<Set> sets;

	public List<Set> getSets() {
		return sets;
	}

	public void setSets(List<Set> sets) {
		this.sets = sets;
		setColorForSet(sets, null);
	}

	public void setSets(List<Set> sets, List<DefaultColorEnum> colors) {
		this.sets = sets;
		setColorForSet(sets, colors);
	}
	//这个以后拓展用
	public void setSetsForStringColor(List<Set> sets, List<String> colors) {

	}

	public void setColorForSet(List<Set> sets, List<DefaultColorEnum> colors) {
		if(colors != null && colors.size() != 0){
			int i = 0;
			for(Set set : sets){
				set.setColor(colors.get(i).getColor());
				i++;
				if(i == colors.size())
					i = 0;
			}
		}else{
			for(Set set : sets){
				set.setColor(DefaultColorEnum.ONE.getColor());
			}
		}
	}
}
